package enumdemo;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * @Author 12629
 * @Description：
 */
public class Test {

    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        Class<?> c1 = Class.forName("enumdemo.TestEnum");

        Constructor[] constructors = c1.getDeclaredConstructors();
        for (int i = 0; i < constructors.length; i++) {
            System.out.println(constructors[i]);
        }
        System.out.println("============");
        Constructor<?> constructor = c1.getDeclaredConstructor(String.class,int.class,int.class,String.class);

        constructor.setAccessible(true);

        TestEnum testEnum = (TestEnum)constructor.newInstance("haha",99,2,"黄色");

        System.out.println(testEnum);
    }
}
